Search
Picture.setSourceProvider Method
See Also
 






Sets the image source provider of the picture.

Namespace: com.mindfusion.spreadsheet
Package: com.mindfusion.spreadsheet

 Syntax

Java  Copy Code

public void setSourceProvider (
    Supplier<Image> value
)

 Parameters

value

A java.util.function.Supplier instance.

 Remarks

Use the SourceProvider property to supply a callback function that resolves the picture's java.awt.Image on demand, rather than holding an instantiated Image in memory via the Source property. When both are specified, SourceProvider takes precedence.

This is particularly beneficial for:

  • Performance & Deferred Loading: Prevents upfront loading and decoding overhead of large images when opening or populating workbooks. The image is requested only when the picture needs to be drawn or when its intrinsic dimensions are calculated.
  • Memory Optimization: In workbooks containing numerous pictures (such as product catalogs, asset inventories, or photo reports), preloading all images can quickly exhaust JVM heap memory. SourceProvider allows implementing on-demand loading or eviction strategies (such as WeakReference or LRU caches) so off-screen images do not consume memory continuously.
  • Dynamic & Remote Assets: Simplifies integrating images streamed from databases, file servers, cloud storage, or procedurally generated graphics without managing manual lifecycle hooks across worksheet views.

 See Also